package com.diligent.cloud.sfc.resources;

import com.canny.commons.model.ListResult;
import com.canny.commons.model.ObjectResult;
import com.canny.commons.model.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.security.Principal;

/**
 * ProcessDataResource class
 * 工艺数据资源
 * @author xf107278
 * @date 3/27/2020
 */
@RequestMapping("/sfc")
public interface CraftDataResource {


    @GetMapping("/capp-mach-runtime-params/{machCode}/{deviceType}")
    @ApiOperation(value = "工艺数据/获取机台实时工艺数据", notes = "工艺数据/获取机台实时工艺数据", tags = {"工艺数据"})
    ResponseEntity<Result> getElineRuntimeParams(@ApiParam(name = "machCode", value = "机台代码", type = "String") @PathVariable("machCode") String machCode
            , @ApiParam(name = "deviceType", value = "设备类型\n if:棒炉\n fif:工频炉\n mf:模具炉\n em:挤压机\n tm:牵引机", type = "String")
                                                 @PathVariable("deviceType") String deviceType);


    @GetMapping("/capp-mach-event/{machCode}/{timeEnd}/{duration}")
    @ApiOperation(value = "工艺数据/获取机台事件工艺参数", notes = "工艺数据/获取机台事件工艺参数", tags = {"工艺数据"})
    ResponseEntity<ListResult> getElineEventTable(@ApiParam(name = "machCode", value = "机台代码", type = "String") @PathVariable("machCode") String machCode
            , @ApiParam(name = "timeEnd", value = "截至时间,Unix时间戳，自1970-01-01 00:00:00 历史秒数（1582706903）", type = "String")
                                                      @PathVariable("timeEnd") String timeEnd
            , @ApiParam(name = "duration", value = "时长（秒）", type = "String") @PathVariable("duration") String duration);


    @GetMapping("/capp-mach-event/{machCode}")
    @ApiOperation(value = "工艺数据/获取机台事件工艺参数", notes = "工艺数据/获取机台事件工艺参数", tags = {"工艺数据"})
    ResponseEntity<ObjectResult> getCraftDataResource( @PathVariable("machCode") String machCode, @AuthenticationPrincipal Principal principal);

    @GetMapping("/capp-mat-cad/{matCode}")
    @ApiOperation(value = "工艺数据/获取物料CAD图纸", notes = "工艺数据/获取物料CAD图纸", tags = {"工艺数据"})
    ResponseEntity<ObjectResult<String>> getItemIdByMatCode(@PathVariable("matCode") String matCode);
}
